from selenium import webdriver
import time
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By

# 指定路径
service = Service(executable_path='D:/qiku/level4/chromedriver.exe')
# 选择浏览器
driver = webdriver.Chrome(service=service)
# 打开浏览器
driver.get('https://www.baidu.com/')

# 找到入框
input = driver.find_element(By.ID, 'chat-textarea')
input.clear()
input.send_keys('天气')

time.sleep(1)
# 找到搜索按钮
button = driver.find_element(By.ID, 'chat-submit-button')
button.click()



time.sleep(4)
driver.quit()